/*
 * ﻿Copyright (C) 2011-2014 NewMain Softech
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.newmainsoftech.aspectjutil.adviseutil;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

/**
 * This class is being used during integration-test phase to test {@link AspectJWeaverAgentLoader) and 
 * {@link DynamicAspectJWeaverAgent}. 
 * 
 * @author <a href="mailto:artymt@gmail.com">Arata Y.</a>
 */
public class HollowClassForTestingAspectJWeaverAgentLoader {
	public static final String NotWovenYetStr = "NotWovenYet";
	public static final String WovenStr = "Woven";
	
	private String testSting = HollowClassForTestingAspectJWeaverAgentLoader.NotWovenYetStr;
		public String getTestSting() {
			return testSting;
		}
		public void setTestSting( String testSting) {
			this.testSting = testSting;
		}
	
	/**
	 * Dummy method to be woven by HollowClassAbstractAspect aspect
	 */
	public void weave() {
	}
		
	@Aspect
	public static abstract class HollowClassAbstractAspect {
/*		@Pointcut( "execution( " 
				+ "public void com.newmainsoftech.aspectjutil.adviseutil" 
				+ ".HollowClassForTestingAspectJWeaverAgentLoader.weave())")
		public static void pointcutAtExecutionOfGetTestSting() {}
*/
		@Pointcut
		public abstract void pointcutAtExecutionOfGetTestSting();
			@AfterReturning( value="pointcutAtExecutionOfGetTestSting()")
			public void afterReturningAdvisedExecutionOfGetTestSting( JoinPoint joinPoint) {
				HollowClassForTestingAspectJWeaverAgentLoader target 
				= (HollowClassForTestingAspectJWeaverAgentLoader)(joinPoint.getTarget());
				target.setTestSting( HollowClassForTestingAspectJWeaverAgentLoader.WovenStr);
			}
	}
}
